﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Index2.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
车辆使用信息查询
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript">
        var id = 'UseVehicleNO';
        var ctrlName = 'VehicleQueryService';
        function Crud2(id, ctrlName) {
            //根据死者编号或姓名查询，查询的结果不分页
            this.Search = function () {
                var form = $('#fm');
                if (!$(form).form('validate')) {
                    return;
                }
                url = '../' + ctrlName + '/Search';
                var data = $(form).serialize();
                $.post(url, data, function (result) {
                    if (result.success) {                        
                        $('#dg').datagrid('loadData', result);        // reload the user data
                    } else {
                        $.messager.show({
                            title: '错误',
                            msg: result.msg
                        });
                    }
                });
            };
            
            //打印死者费用明细
            this.Print = function () {
                var ids = [];
                var rows = $('#dg').datagrid('getRows');
                var totals = new Number();
                for (var i = 0; i < rows.length; i++) {
                    ids.push(rows[i][id]);
                    totals += rows[i]['ServiceFee'];
                }
                if (ids.length < 1) {
                    $.messager.alert('提示', '没有内容可印!', 'info');
                    return;
                }
                var data = $('#fm').serialize(); ;                
                var url = '../' + ctrlName + '/PrintUseVehicleList?'+data;
                ShowDialog(url, '打印', '800px', '600px');
            };
        }
        var crud = new Crud2(id, ctrlName);
        $(function () {
            $('#dg').datagrid({
                title: '车辆使用信息列表',
                iconCls: 'icon-save',
                url: '../' + ctrlName + '/List',
                sortName: id,
                sortOrder: 'asc',
                remoteSort: false,
                idField: id,
                frozenColumns: [[
	                { field: 'ck', checkbox: true },
	                { title: '编号', field: id, width: 80, sortable: true }                    
				]],
                columns: [[
                        { field: 'MeetAddress', title: '起点', width: 150 },
                        { field: 'SendAddress', title: '终点', width: 150 },
                        { field: 'ServiceCount', title: '公里数', width: 80 },
                        { field: 'ServiceFee', title: '费用(元)', width: 80 },                        
                        { field: 'VehicleNO', title: '车辆', width: 100 },
                        { field: 'Name', title: '司机', width: 100 }                        
                    ]],
                pagination: false,
                fitColumns: true,
                showFooter:true,
                toolbar: '#tb'
            });
        });         
    </script>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <div id="dlg" class="easyui-dialog" closed="true" buttons="#dlg-buttons" 
			style="width:800px;height:480px;padding:10px 20px">
		<div class="ftitle">车辆使用信息</div>
	</div>
    <div id="tb" style="padding:5px;height:auto">          
        <div style="float:left">  
            <form id="fm">
            时间：从 <input name="StartTime"   class="easyui-datebox" style="width:120px" required="true" />到
            <input name="EndTime"   class="easyui-datebox" style="width:120px" required="true" />
            司机<input name="DriverNO"   class="easyui-validatebox" style="width:80px"  /> 
            车辆<input name="VehicleNO"   class="easyui-validatebox" style="width:80px" />               
            <a href="#" class="easyui-linkbutton" iconCls="icon-search" onclick="crud.Search()">查询</a>            
            <a href="#" class="easyui-linkbutton" iconCls="icon-print" onclick="crud.Print()">打印</a>             
            </form>            
        </div>        
    </div>  
</asp:Content>


